package com.gingko.duominuo.data.request

import android.os.Parcelable
import com.gingko.duominuo.data.model.JobWorkVo
import kotlinx.parcelize.Parcelize

data class SubmitWorkOrderReqVo(
    var id: String? = null,
    var data: MutableList<ReviewInfoVo> = mutableListOf(),
    var signature: String? = null
)

/**
 * code: 0/1  1表示对应的任务有相关的数据 0相反
 * status: true/false true 等同于code 1 flase 等同于0
 * id:订单详情接口返回的任务数组每个hashMap对应的id（task_id）
 * count: {"click_count":”观看数”, "digg_count": “点赞数”, "comment_count": “评论数”, "share_count":“转发数”, "collect_count": “收藏数”} ；当视频没有某一个数量字段时默认-1
 */
data class ReviewInfoVo(
    var code: Int = 1,
    var count: Count = Count(),
    var id: String? = null,
    var status: Boolean? = null,
    var extra: Extra = Extra(),
)

@Parcelize
data class Count(
    var click_count: Int? = -1,
    var collect_count: Int? = -1,
    var comment_count: Int? = -1,
    var digg_count: Int? = -1,
    var share_count: Int? = -1,
) : Parcelable

data class Extra(
    var images: MutableList<String>? = null,
    var perfect: Boolean? = null,
    var reject_reason: String? = null
)

fun ReviewInfoVo.asTaskJobVo(): JobWorkVo {
    return JobWorkVo(
        code = this.code,
        workId = this.id,
        status = this.status,
        click_count = this.count.click_count,
        collect_count = this.count.collect_count,
        comment_count = this.count.comment_count,
        digg_count = this.count.digg_count,
        share_count = this.count.share_count,
        images = this.extra.images ?: mutableListOf(),
        perfect = this.extra.perfect,
        reject_reason = this.extra.reject_reason,
    )
}